package com.news.util;

import java.util.List;

public class PageModel {
	
	@SuppressWarnings("rawtypes")
	private List datas;
	
	private int currPage;
	
	private int pageSize = 20;// Ĭ��ÿҳ��ʾ20����¼
	
	private int totals;
	
	private int pageCount;
	
	private int nextPage;
	
	private int prevPage;
	
	private String url;

	public PageModel() {

	}

	
	@SuppressWarnings("rawtypes")
	public PageModel(int totals, List datas, int currPage) {
		this(totals, datas, 20, currPage);
	}

	
	@SuppressWarnings("rawtypes")
	public PageModel(int totals, List datas, int pageSize, int currPage) {
		this.totals = totals;
		this.datas = datas;
		this.pageSize = pageSize;
		this.currPage = currPage;
		if (totals % pageSize == 0) {
			this.pageCount = totals / pageSize;
		} else {
			this.pageCount = totals / pageSize + 1;
		}
		this.nextPage = this.currPage + 1 > this.pageCount ? this.pageCount
				: this.currPage + 1;
		this.prevPage = this.currPage - 1 < 1 ? 1 : this.currPage - 1;

	}

	@SuppressWarnings("rawtypes")
	public List getDatas() {
		return datas;
	}

	@SuppressWarnings("rawtypes")
	public void setDatas(List datas) {
		this.datas = datas;
	}

	public int getCurrPage() {
		return currPage;
	}

	public void setCurrPage(int currPage) {
		this.currPage = currPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotals() {
		return totals;
	}

	public void setTotals(int totals) {
		this.totals = totals;
	}

	public int getPageCount() {
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public int getNextPage() {
		return nextPage;
	}

	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	public int getPrevPage() {
		return prevPage;
	}

	public void setPrevPage(int prevPage) {
		this.prevPage = prevPage;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

}
